package com.yf.controller;

import com.yf.api.ProApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Yang_Vincent
 * @Date 2020/7/23 14:43
 */
@RestController
@RequestMapping("/")
@RefreshScope
public class TestController implements ProApi {

    @Value("${server.port}")
    String port;

    @Value("${user.env}")
    String name;

    @Override
    @GetMapping("/hi/{name}")
    public String getInfo(@PathVariable("name") String name) {

        return "hi, i'm from port:" + port + ",我是：" + name;
    }

    @GetMapping("/jack")
     public String getForConfig(){


        return "我是来自配置，我是：" + name + "端口为：" + port;
    }
}
